$("#addadmin").click(function() {
		$.ajax({
			xhrFields:{withCredentials: true},
			url:"http://localhost:16111/activity/adadmi",
			method: "get",
			dataType: "json",
			data:{
				name:document.getElementById("name").value,
				dizi:document.getElementById("dizi").value
			},
			success:function(data){
				xxx(0)
			
		
			},
			errer:function(){
				alert("no")
			}
			
		})
		
		
	})

	function xxx(x) {
		if(x<0){
			alert("这是第一页");
			return;
		}
		var stc="";	
		$.ajax({
			xhrFields:{withCredentials: true},
			url:"http://localhost:16111/activity/admin",
			method: "get",
			dataType: "json",
			data:{
				feiye:x
			},
			success:function(data){
			
				
				var zt;
				var zz;
		
				for(var i=0;i<data.length;i++){
					
					if(data[i].status==0){
						zt="激活"
						zz="关闭"
					}else{
						zt="关闭";
						zz="激活"
					}
					    
					stc+="<tr>" +
						 "<td class='text-center' >" + data[i].id + "</td>" +  
					    "<td class='text-center'>" + data[i].name + "</td>" +  
						 "<td class='text-center'>" + data[i].ress + "</td>" +  
						  "<td class='text-center'>" + data[i].imgs + "</td>" +
						  "<td class='text-center'>" + zt + "</td>" +  
						  ' <td class="text-center">  <button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#layer" onclick="cc(this)" >'+zz+'</button>'+
							'<button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#layer" onclick="sc(this)" >删除</button>'+
						  
						  '</td>'
					     "</tr>";

				}
				
				
				
			 
				document.getElementById("www").innerHTML=stc
				document.getElementById("fei").innerHTML="<button onclick='xxx("+(x-4)+")'>上一页</button> <button onclick='xxx("+(x+4)+")'>下一页</button>"
			
			},
			errer:function(){
				alert("no")
			}
			
		})
	}
	
	function sc (x) {
		var tr=$(x).closest("tr");
		var coll=tr.find("td:eq(0)").text();
		var co=tr.find("td:eq(4)").text();
		
		if(co=="激活"){
			alert("请先关闭");
			return;
		}
		
		$.ajax({
			xhrFields:{withCredentials: true},
			url:"http://localhost:16111/activity/schuo",
			method: "get",
			dataType: "json",
			data:{
				id:coll
				
			},
			success:function(data){
				xxx(0);
			},
			errer:function(){
				alert("no");
			}})
		
		
	}
		function cc (x) {
			var tr=$(x).closest("tr");
			var coll=tr.find("td:eq(0)").text();
			var co=tr.find("td:eq(4)").text();
			
			if(co=="关闭"){
				q=0;
			}else{
				q=1;
			}
			
			$.ajax({
				xhrFields:{withCredentials: true},
				url:"http://localhost:16111/activity/adxius",
				method: "get",
				dataType: "json",
				data:{
					id:coll,
					zt:q
				},
				success:function(data){
					
					xxx(0);
				},
				errer:function(){
					alert("no");
				}})
		}
		xxx(0);